import { fromJS } from 'immutable';

import {
  UPDATE_SUB_TAB_LIST,
} from './constents';

const defaultState = fromJS({
  subTabList: [
    {
      id: 1, title: '达成', active: true, url: '/app',
    },
    {
      id: 2, title: '奖金规划', active: false, url: '/app/pointsAndBonus/plan',
    },
  ],
});

export default (state = defaultState, action: { type: string, value: any}) => {
  switch (action.type) {
    case UPDATE_SUB_TAB_LIST:
      return state.set('subTabList', action.value);
    default:
      return state;
  }
};
